package operator

import (
	"github.com/gin-gonic/gin"
	"project/pkg/dao/mysql"
	"project/pkg/mildware"
	"project/pkg/router"
)

func init() {
	router.AddRouter(new(ORouter))
}

type ORouter struct {
}
type OHandler struct {
	M mysql.Mysql
}

func NewOHandler() *OHandler {
	return &OHandler{
		M: mysql.NewMysql(),
	}
}
func (ORouter) Router(e *gin.Engine) {
	handler := NewOHandler()
	op := e.Group("op")
	op.POST("/login", handler.OpLogin)
	op.POST("/update", handler.UpdateInfo)
	op.GET("/search/teacher", handler.SearchOpToTeacher)
	op.GET("/delete", handler.DeleteOp)
	op.Use(mildware.JWTAuthMiddleware())
	op.POST("/create", handler.Create)
}
